package org.gdpu.model;

import org.gdpu.util.ExcelResources;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

/**
 * 考生信息
 */
@Entity
public class Examiner {

    /**
     * 系统序号
     */
    private int id;

    /**
     * 考生学号
     */
    private Person studentID;
    /**
     * 考试
     */
    private Examination examination;
    /**
     * 考试总分
     */
    private float score;
    /**
     * 考生答案
     */
    private Set<Score> examinerAnswers;
    /**
     * 考试开始时间
     */
    private Date examBeginTime;
    /**
     * 考试结束时间
     */
    private Date examEndTime;

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "accout")
    public Person getStudentID() {
        return studentID;
    }

    public void setStudentID(Person studentID) {
        this.studentID = studentID;
    }

    public Date getExamBeginTime() {
        return examBeginTime;
    }

    public void setExamBeginTime(Date examTime) {
        this.examBeginTime = examTime;
    }

    public Date getExamEndTime() {
        return examEndTime;
    }

    public void setExamEndTime(Date examEndTime) {
        this.examEndTime = examEndTime;
    }

    @ManyToOne
    @JoinColumn(name = "examination")
    public Examination getExamination() {
        return examination;
    }

    public void setExamination(Examination examination) {
        this.examination = examination;
    }

    public float getScore() {
        return score;
    }

    public void setScore(float score) {
        this.score = score;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "examiner")
    public Set<Score> getExaminerAnswers() {
        return examinerAnswers;
    }

    public void setExaminerAnswers(Set<Score> examinerAnswers) {
        this.examinerAnswers = examinerAnswers;
    }

    public Examiner() {
        super();
    }


}
